/*
 * eventQueue.h
 *
 *  Created on: Apr 12, 2015
 *      Author: mxw
 */

#ifndef EVENTQUEUE_H_
#define EVENTQUEUE_H_

#include "cmd_def.h"

#define MAX_Q_ITEM_CNT  (32)

typedef struct {
    unsigned char cmd;
    unsigned char data[15];
} Queue_Element;

typedef struct {
    unsigned char read_pos;
    unsigned char write_pos;
    unsigned char cnt;
    Queue_Element q[MAX_Q_ITEM_CNT];
} QueMgr;

extern QueMgr g_Main_Queue;

void init_event_queue(QueMgr* qmgr);
int push_event(QueMgr* qmgr, Queue_Element* pq_ele);
Queue_Element* pick_msg(QueMgr* qmgr);


#endif /* EVENTQUEUE_H_ */
